<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{$lang.home}{if $ur_here} - {$ur_here} {/if}</title>
<meta name="Copyright" content="Douco Design." />
<link href="templates/public.css" rel="stylesheet" type="text/css">
{include file="javascript.htm"}
<script type="text/javascript" src="images/jquery.autotextarea.js"></script>
</head>
<body>
<div id="dcWrap">
 {include file="header.htm"}
 <div id="dcLeft">{include file="menu.htm"}</div>
 <div id="dcMain">
   {include file="ur_here.htm"}
   <div class="mainBox" style="{$workspace.height}">
    <!-- {if $rec eq 'default'} 商品列表 -->
    <h3><a href="{$action_link.href}" class="actionBtn add">{$action_link.text}</a>{$ur_here}</h3>
    <div class="filter">
    <form action="product.php" method="post">
     <select name="cat_id">
      <option value="0">{$lang.uncategorized}</option>
      <!-- {foreach from=$product_category item=cate} -->
      <!-- {if $cate.cat_id eq $cat_id} -->
      <option value="{$cate.cat_id}" selected="selected">{$cate.mark} {$cate.cat_name}</option>
      <!-- {else} -->
      <option value="{$cate.cat_id}">{$cate.mark} {$cate.cat_name}</option>
      <!-- {/if} -->
      <!-- {/foreach} -->
     </select>
     <input name="keyword" type="text" class="inpMain" value="{$keyword}" size="20" />
     <input name="submit" class="btnGray" type="submit" value="{$lang.btn_filter}" />
    </form>
    <span>
    <a class="btnGray" href="product.php?rec=re_thumb">{$lang.product_thumb}</a>
    <!-- {if $if_sort} -->
    <a class="btnGray" href="product.php?rec=sort">{$lang.sort_close}</a>
    <!-- {else} -->
    <a class="btnGray" href="product.php?rec=sort">{$lang.sort_product}</a>
    <!-- {/if} -->
    </span>
    </div>
    <!-- {if $if_sort} -->
    <div class="homeSortRight">
     <ul class="homeSortBg">
      {$sort_bg}
     </ul>
     <ul class="homeSortList">
      <!-- {foreach from=$sort name=sort item=product} -->
      <li>
       <img src="{$product.image}" width="60" height="60">
       <a href="product.php?rec=del_sort&id={$product.id}" title="{$lang.sort_cancel}">X</a>
      </li>
      <!-- {/foreach} -->
     </ul>
    </div>
    <!-- {/if} -->
    <div id="list"{if $if_sort} class="homeSortLeft"{/if}>
    <form name="action" method="post" action="product.php?rec=action">
    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      <tr>
        <th width="22" align="center"><input name='chkall' type='checkbox' id='chkall' onclick='selectcheckbox(this.form)' value='check'></th>
        <th width="40" align="center">{$lang.record_id}</th>
        <th align="left">{$lang.name}</th>
        <th width="150" align="center">{$lang.product_category}</th>
       <th width="80" align="center">{$lang.add_time}</th>
        <th width="80" align="center">{$lang.handler}</th>
      </tr>
      <!-- {foreach from=$product_list item=product} -->
      <tr>
        <td align="center"><input type="checkbox" name="checkbox[]" value="{$product.id}" /></td>
        <td align="center">{$product.id}</td>
        <td><a href="product.php?rec=edit&id={$product.id}">{$product.name}</a></td>
        <td align="center"><!-- {if $product.cat_name} --><a href="product.php?cat_id={$product.cat_id}">{$product.cat_name}</a><!-- {else} -->{$lang.uncategorized}<!-- {/if} --></td>
        <td align="center">{$product.add_time}</td>
        <td align="center">
         <!-- {if $if_sort} -->
         <a href="product.php?rec=set_sort&id={$product.id}">{$lang.sort_btn}</a>
         <!-- {else} -->
         <a href="product.php?rec=edit&id={$product.id}">{$lang.edit}</a> | <a href="product.php?rec=del&id={$product.id}">{$lang.del}</a>
         <!-- {/if} -->
        </td>
      </tr>
      <!-- {/foreach} -->
    </table>
    <div class="action">
     <select name="action" onchange="douAction()">
      <option value="0">{$lang.select}</option>
      <option value="del_all">{$lang.del}</option>
      <option value="category_move">{$lang.category_move}</option>
     </select>
     <select name="new_cat_id" style="display:none">
      <option value="0">{$lang.uncategorized}</option>
      <!-- {foreach from=$product_category item=cate} -->
      <!-- {if $cate.cat_id eq $cat_id} -->
      <option value="{$cate.cat_id}" selected="selected">{$cate.mark} {$cate.cat_name}</option>
      <!-- {else} -->
      <option value="{$cate.cat_id}">{$cate.mark} {$cate.cat_name}</option>
      <!-- {/if} -->
      <!-- {/foreach} -->
     </select>
     <input name="submit" class="btn" type="submit" value="{$lang.btn_execute}" />
    </div>
    </form>
    </div>
    <div class="clear"></div>
    {include file="pager.htm"}
    <!-- {/if} -->
    <!-- {if $rec eq 'add' || $rec eq 'edit'} 商品添加或编辑 -->
    <h3><a href="{$action_link.href}" class="actionBtn">{$action_link.text}</a>{$ur_here}</h3>
    <form action="product.php?rec={$form_action}" method="post" enctype="multipart/form-data">
     <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      <tr>
       <td width="90" align="right">{$lang.name}</td>
       <td>
        <input type="text" name="name" value="{$product.name}" size="80" class="inpMain" />
       </td>
      </tr>
      <tr>
       <td align="right">{$lang.product_category}</td>
       <td>
        <select name="cat_id">
         <option value="0">{$lang.uncategorized}</option>
         <!-- {foreach from=$product_category item=cate} -->
         <!-- {if $cate.cat_id eq $product.cat_id} -->
         <option value="{$cate.cat_id}" selected="selected">{$cate.mark} {$cate.cat_name}</option>
         <!-- {else} -->
         <option value="{$cate.cat_id}">{$cate.mark} {$cate.cat_name}</option>
         <!-- {/if} -->
         <!-- {/foreach} -->
        </select>
       </td>
      </tr>
      <tr>
       <td align="right">{$lang.product_price}</td>
       <td>
        <input type="text" name="price" value="{if $product.price}{$product.price}{else}0{/if}" size="40" class="inpMain" />
       </td>
      </tr>
      <!-- {if $product.defined} -->
      <tr>
       <td align="right" valign="top">{$lang.product_defined}</td>
       <td>
        <textarea name="defined" id="defined" cols="50" class="textAreaAuto" style="height:{$product.defined_count}0px">{$product.defined}</textarea>
        <script type="text/javascript">
         {literal}
         $("#defined").autoTextarea({maxHeight:300});
         {/literal}
        </script>
        </td>
      </tr>
      <!-- {/if} -->
      <tr>
       <td align="right" valign="top">{$lang.product_content}</td>
       <td>
        <!-- KindEditor -->
        <script charset="utf-8" src="include/kindeditor/kindeditor.js"></script>
        <script charset="utf-8" src="include/kindeditor/lang/zh_CN.js"></script>
        <script>
        {literal}
         var editor;
         KindEditor.ready(function(K) {
             editor = K.create('#content');
         });
        {/literal}
        </script>
        <!-- /KindEditor -->
        <textarea id="content" name="content" style="width:780px;height:400px;" class="textArea">{$product.content}</textarea>
       </td>
      </tr>
      <tr>
       <td align="right">{$lang.thumb}</td>
       <td>
        <input type="file" name="image" size="38" class="inpFlie" />
        {if $product.image}<a href="../{$product.image}" target="_blank"><img src="images/icon_yes.png"></a>{else}<img src="images/icon_no.png">{/if}</td>
      </tr>
      <tr>
       <td align="right">{$lang.keywords}</td>
       <td>
        <input type="text" name="keywords" value="{$product.keywords}" size="50" class="inpMain" />
       </td>
      </tr>
      <tr>
       <td align="right">{$lang.description}</td>
       <td>
        <input type="text" name="description" value="{$product.description}" size="50" class="inpMain" />
       </td>
      </tr>
      <tr>
       <td></td>
       <td>
        <input type="hidden" name="token" value="{$token}" />
        <input type="hidden" name="id" value="{$product.id}">
        <input name="submit" class="btn" type="submit" value="{$lang.btn_submit}" />
       </td>
      </tr>
     </table>
    </form>
    <!-- {/if} -->
    <!-- {if $rec eq 're_thumb'} -->
    <h3><a href="{$action_link.href}" class="actionBtn">{$action_link.text}</a>{$ur_here}</h3>
    <script type="text/javascript">
    {literal}
     function mask(i) {
        document.getElementById('mask').innerHTML += i;
        document.getElementById('mask').scrollTop = 100000000;
     }
     function success() {
        var d=document.getElementById('success');
        d.style.display="block";
     }
    {/literal}
    </script>
    <dl id="maskBox">
     <dt><em>{$mask.count}</em><!-- {if !$mask.confirm} --><form action="product.php?rec=re_thumb" method="post"><input name="confirm" class="btn" type="submit" value="{$lang.product_thumb_start}" /></form><!-- {/if} --></dt>
     <dd class="maskBg">{$mask.bg}<i id="success">{$lang.product_thumb_succes}</i></dd>
     <dd id="mask"></dd>
    </dl>
    <!-- {/if} -->
   </div>
 </div>
 {include file="footer.htm"}
 </div>
<!-- {if $rec eq 'default'} 商品列表 -->
<script type="text/javascript">
{literal}
onload = function()
{
 document.forms['action'].reset();
}

function douAction()
{
 var frm = document.forms['action'];
 frm.elements['new_cat_id'].style.display = frm.elements['action'].value == 'category_move' ? '' : 'none';
}
{/literal}
</script>
<!-- {/if} -->
<!-- {if $rec neq 're_thumb'} -->
</body>
</html>
<!-- {/if} -->